package com.jp.java8;

import java.util.Arrays;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class NumericStream {

    public static void main(String[] args) {
        Stream<Integer> stream = Arrays.stream(new Integer[]{1,2,3,4,5});
        int result  = stream.mapToInt(i->i.intValue()).sum();
        System.out.println(result);

        int a=9;
        IntStream.rangeClosed(1, 100)
                .filter(b -> Math.sqrt(a * a + b * b) % 1 == 0)
                .boxed()
                .map(b->new int[]{a,b,(int)Math.sqrt(a*a + b*b)})
                .forEach(r->System.out.println(r[0]+","+r[1]+","+r[2]));

    }
}
